from ttkbootstrap.localization.msgcat import MessageCatalog

MESSAGES = []


def initialize_localities():
    """Load all custom msg files."""
    for m in MESSAGES:
        m.initialize()


class LocaleMsgs:
    """A helper class to allow loading the library message catalog
    without having to package library resources which can cause
    problems with creating distributable applications with some
    packagers."""

    def __init__(self, locale, *msgs):
        self.locale = locale
        self.messages = msgs

    def initialize(self):
        """Initialize this locale in the MessageCatalog"""
        from itertools import chain

        messages = list(chain(*self.messages))
        MessageCatalog.set_many(self.locale, *messages)


MESSAGES.append(
    # CZECH translation
    LocaleMsgs(
        "cs",
        ("Continue", "Pokračovat"),
        ("Retry", "Znovu"),
        ("Delete", "Vymazat"),
        ("Next", "Další"),
        ("Prev", "Předchozí"),
        ("Yes", "Ano"),
        ("No", "Ne"),
        ("Open", "Otevřený"),
        ("Close", "Zavřít"),
        ("Add", "Přidat"),
        ("Remove", "Odstranit"),
        ("Submit", "Podat"),
        ("Family", "Rodina"),
        ("Weight", "Hmotnost"),
        ("Slant", "Sklonit"),
        ("Effects", "Účinky"),
        ("Preview", "Náhled"),
        ("Size", "Velikost"),
    )
)
MESSAGES.append(
    # DANISH translation
    LocaleMsgs(
        "da",
        ("Continue", "Fortsætte"),
        ("Retry", "Prøv"),
        ("Delete", "Slette"),
        ("Next", "Næste"),
        ("Prev", "Forrige"),
        ("Yes", "Ja"),
        ("No", "Nej"),
        ("Open", "Åben"),
        ("Close", "Lukke"),
        ("Add", "Tilføje"),
        ("Remove", "Fjerne"),
        ("Submit", "Indsende"),
        ("Family", "Familie"),
        ("Weight", "Vægt"),
        ("Slant", "Drejning"),
        ("Effects", "Effekter"),
        ("Size", "Størrelse"),
    )
)
MESSAGES.append(
    # SPANISH translation
    LocaleMsgs(
        "es",
        ("Cancel", "Cancelar"),
        ("Retry", "Reintentar"),
        ("Delete", "Borrar"),
        ("Next", "Próximo"),
        ("Prev", "Anterior"),
        ("Yes", "Sí"),
        ("Open", "Abrir"),
        ("Close", "Cerrar"),
        ("Add", "Agregar"),
        ("Remove", "Eliminar"),
        ("Submit", "Enviar"),
        ("Family", "Familia"),
        ("Weight", "Peso"),
        ("Slant", "Inclinación"),
        ("Effects", "Efectos"),
        ("Preview", "Vista previa"),
        ("Size", "Tamaño"),
    )
)
MESSAGES.append(
    # PORTUGUESE - BRAZIL translation   
    LocaleMsgs(
        "pt_br",
        ("Retry", "Repetir"),
        ("Delete", "Excluir"),
        ("Next", "Próximo"),
        ("Prev", "Anterior"),
        ("Yes", "Sim"),
        ("No", "Não"),
        ("Open", "Abrir"),
        ("Close", "Fechar"),
        ("Add", "Adicionar"),
        ("Remove", "Remover"),
        ("Submit", "Enviar"),
        ("Family", "Família"),
        ("Weight", "Espessura"),
        ("Slant", "Estilo"),
        ("Effects", "Efeitos"),
        ("Preview", "Visualizar"),
        ("Size", "Tamanho"),
        ("Should be of data type", "Deve ser do tipo de dados"),
        ("Invalid data type", "Tipo de dados inválido"),
        ("Number cannot be greater than", "O número não deve ser maior que"),
        ("Out of range", "Fora do limite"),
        ("Previous", "Anterior"),
        (
            "The quick brown fox jumps over the lazy dog.",
            "A rápida raposa marrom pula sobre o cachorro preguiçoso.",
        ),
        ("Font Selector", "Seletor de Fontes"),
        ("normal", "normal"),
        ("bold", "negrito"),
        ("roman", "romano"),
        ("italic", "itálico"),
        ("underline", "sublinhado"),
        ("overstrike", "taxado"),
        ("Color Chooser", "Seletor de Cores"),
        ("Advanced", "Avançado"),
        ("Themed", "Tema"),
        ("Standard", "Básicas"),
        ("Current", "Atual"),
        ("New", "Nova"),
        ("Hue", "Matiz"),
        ("Sat", "Sat"),
        ("Lum", "Lum"),
        ("Hex", "Hex"),
        ("Red", "Vermelho"),
        ("Green", "Verde"),
        ("Blue", "Azul"),
        ("color dropper", "Selecionador de cores (conta-gotas)"),
        ("Cancel", "Cancelar"),
        ("Search", "Buscar"),
        ("Page", "Página"),
        ("of", "de"),
        ("⎌", "↺"),
        ("Reset table", "Resetar Tabela"),
        ("Columns", "Colunas"),
        ("Move", "Mover"),
        ("Align", "Alinhar"),
        ("Hide column", "Ocultar coluna"),
        ("Delete column", "Excluir coluna"),
        ("Show All", "Exibir todas"),
        ("Move to left", "Mover para esquerda"),
        ("Move to right", "Mover para direira"),
        ("Move to first", "Mover para o início"),
        ("Move to last", "Mover para o fim"),
        ("Align left", "Alinhar à esquerda"),
        ("Align center", "Alinhar ao centro"),
        ("Align right", "Alinhar à direita"),
        ("Sort", "Classificar"),
        ("Filter", "Filtrar"),
        ("Export", "Exportar"),
        ("Delete selected rows", "Excluir linhas selecionadas"),
        ("Sort Ascending", "Ordem crescente"),
        ("Sort Descending", "Ordem decrescente"),
        ("Clear filters", "Limpar filtros"),
        ("Filter by cell's value", "Filtrar pelo valor da célula"),
        ("Hide select rows", "Ocultar linha selecionada"),
        ("Show only select rows", "Exibir somente as linhas selecionadas"),
        ("Export all records", "Exportar todos os dados"),
        ("Export current page", "Exportar página atual"),
        ("Export current selection", "Exportar seleção atual"),
        ("Export records in filter", "Exportar dados do filtro"),
        ("Move up", "Mover para cima"),
        ("Move down", "Mover para baixo"),
        ("Move to top", "Mover para o início"),
        ("Move to bottom", "Mover para o fim"),
        ("Mo", "S"),
        ("Tu", "T"),
        ("We", "Q"),
        ("Th", "Q"),
        ("Fr", "S"),
        ("Sa", "S"),
        ("Su", "D"),
    )
)
MESSAGES.append(
    # CHINESE - CHINA translation
    LocaleMsgs(
        "zh_cn",
        ("&Abort", "&中止"),
        ("&About...", "&关于……"),
        ("All Files", "所有文件"),
        ("Application Error", "应用程序错误"),
        ("&Apply", "&添加"),
        ("Bold", "粗体"),
        ("Bold Italic", "加粗斜体"),
        ("&Blue", "&蓝色"),
        ("Cancel", "取消"),
        ("&Cancel", "&取消"),
        (
            'Cannot change to the directory %1\$s.\nPermission denied.',
            '无法更改目录 %1\$s。\n访问被拒绝。',
        ),
        ("Choose Directory", "选择文件夹"),
        ("Cl&ear", "清&除"),
        ("&Clear Console", "&清除终端"),
        ("Color", "颜色"),
        ("Console", "终端"),
        ("&Copy", "&复制"),
        ("Cu&t", "剪&切"),
        ("&Delete", "&删除"),
        ("Details >>", "详细信息 >>"),
        ('Directory %1\$s does not exist.', '目录 %1\$s 不存在。'),
        ("&Directory:", "&目录："),
        ("&Edit", "&编辑"),
        ("Effects", "效果"),
        ("Error: %1\$s", "错误： %1\$s"),
        ("E&xit", "退&出"),
        ("&File", "&文件"),
        (
            'File %1\$s already exists.\nDo you want to overwrite it?',
            '文件 %1\$s 已经存在。\n您想要覆盖它吗？',
        ),
        ('File %1\$s already exists.\n\n', '文件 %1\$s 已经存在。\n\n'),
        ('File %1\$s does not exist.', '文件 %1\$s 不存在。'),
        ("File &name:", "文件&名："),
        ("File &names:", "文件&名："),
        ("Files of &type:", "文件&类型："),
        ("Fi&les:", "文&件："),
        ("&Filter", "&过滤"),
        ("Fil&ter:", "过&滤："),
        ("Font", "字体"),
        ("&Font:", "&字体："),
        ("Font st&yle:", "字体&样式："),
        ("&Green", "&绿色"),
        ("&Help", "&帮助"),
        ("Hi", "你好"),
        ("&Hide Console", "&隐藏终端"),
        ("&Ignore", "&忽略"),
        ('Invalid file name %1\$s.', '无效的文件名 %1\$s。'),
        ("Italic", "斜体"),
        ("Log Files", "日志文件"),
        ("&No", "&取消"),
        ("No", "取消"),
        ("&OK", "&确定"),
        ("OK", "确定"),
        ("Ok", "确定"),
        ("Open", "打开"),
        ("&Open", "&打开"),
        ("Open Multiple Files", "打开多个文件"),
        ("P&aste", "粘&贴"),
        ("&Quit", "&退出"),
        ("&Red", "红色"),
        ("Regular", "规则"),
        ("Replace existing file?", "替换已有文件？"),
        ("&Retry", "&重试"),
        ("Sample", "样式"),
        ("&Save", "&保存"),
        ("Save As", "另存为"),
        ("Save To Log", "保存到日志"),
        ("Select Log File", "选择日志文件"),
        ("Select a file to source", "选择一个源文件"),
        ("&Selection:", "&选择："),
        ("&Size:", "&大小："),
        ("Show &Hidden Directories", "显示&隐藏目录"),
        ("Show &Hidden Files and Directories", "显示&隐藏文件和目录"),
        ("Skip Messages", "跳过信息"),
        ("&Source...", "&来源……"),
        ("Stri&keout", "删&除线"),
        ("Tcl Scripts", "Tcl脚本"),
        ("Tcl for Windows", "适用于Windows的Tcl"),
        ("Text Files", "文本文档"),
        ("&Underline", "&下划线"),
        ("&Yes", "&确定"),
        ("abort", "中止"),
        ("blue", "蓝色"),
        ("cancel", "取消"),
        ("extension", "拓展"),
        ("extensions", "拓展"),
        ("green", "绿色"),
        ("ignore", "忽略"),
        ("ok", "确定"),
        ("red", "红色"),
        ("retry", "重试"),
        ("Retry", "重试"),
        ("yes", "确认"),
        ("Yes", "确认"),
        ("Should be of data type", "应为数据类型"),
        ("Invalid data type", "无效数据类型"),
        ("Number cannot be greater than", "数字不能大于"),
        ("Out of range", "超出范围"),
        ("Submit", "提交"),
        ("Delete", "删除"),
        ("Next", "下一步"),
        ("Previous", "以前的"),
        ("Open", "打开"),
        ("Close", "关闭"),
        ("Add", "添加"),
        ("Remove", "移除"),
        ("Family", "组"),
        ("Weight", "重量"),
        ("Slant", "倾斜"),
        ("Effects", "效果"),
        ("Preview", "预览"),
        ("Size", "大小"),
        ("The quick brown fox jumps over the lazy dog.", "敏捷的棕色狐狸跳过懒惰的狗。"),
        ("Print", "输出"),
        ("Printer", "打印机"),
        ("Letter ", "信 "),
        ("Legal ", "合法的 "),
        ("A4", "A4"),
        ("Grayscale", "灰度"),
        ("RGB", "RGB"),
        ("Options", "设置"),
        ("Copies", "复制"),
        ("Paper", "纸"),
        ("Scale", "规模"),
        ("Orientation", "方向"),
        ("Portrait", "竖向"),
        ("Landscape", "横向"),
        ("Output", "输出"),
    )
)

MESSAGES.append(
    LocaleMsgs(
        # French
        "fr",
        ("OK", "OK"),
        ("Ok", "Ok"),
        ("Retry", "Recommencer"),
        ("Delete", "Supprimer"),
        ("Next", "Suivant"),
        ("Prev", "Préc."),
        ("Yes", "Oui"),
        ("No", "Non"),
        ("Open", "Ouvrir"),
        ("Close", "Fermer"),
        ("Add", "Ajouter"),
        ("Remove", "Supprimer"),
        ("Submit", "Envoyer"),
        ("Family", "Famille"),
        ("Weight", "Poids"),
        ("Slant", "Italique"),
        ("Effects", "Effets"),
        ("Preview", "Prévisualiser"),
        ("Size", "Taille"),
        ("Should be a of data type", "Doit être du type de données"),
        ("Invalid data type", "Type de données invalide"),
        ("Number cannot be greater than", "Le nombre ne peut pas être plus grand que"),
        ("Out of range", "Hors limites"),
        ("Previous", "Précédent"),
        ("The quick brown fox jumps over the lazy dog.", "The quick brown fox jumps over the lazy dog."),
        ("Font Selector", "Sélecteur de Polices"),
        ("normal", "normal"),
        ("bold", "gras"),
        ("roman", "roman"),
        ("italic", "italique"),
        ("underline", "souligné"),
        ("overstrike", "barré"),
        ("Color Chooser", "Sélecteur de couleur"),
        ("Advanced", "Avancé"),
        ("Themed", "Thème"),
        ("Standard", "Standard"),
        ("Current", "Courant"),
        ("New", "Nouveau"),
        ("Hue", "Teinte"),
        ("Sat", "Sat"),
        ("Lum", "Lum"),
        ("Hex", "Hex"),
        ("Red", "Rouge"),
        ("Green", "Vert"),
        ("Blue", "Bleu"),
        ("color dropper", "Sélecteur de couleurs"),
        ("Cancel", "Annuler"),
        ("Search", "Chercher"),
        ("Page", "Page"),
        ("of", "de"),
        ("⎌", "↺"),
        ("Reset table", "Réinit. table"),
        ("Columns", "Colonnes"),
        ("Move", "Déplacer"),
        ("Align", "Aligner"),
        ("Hide column", "Cacher la colonne"),
        ("Delete column", "Supprimer la colonne"),
        ("Show All", "Afficher tout"),
        ("Move to left", "Déplacer vers la gauche"),
        ("Move to right", "Déplacer vers la droite"),
        ("Move to first", "Déplacer en premier"),
        ("Move to last", "Déplacer en dernier"),
        ("Align left", "Aligner à gauche"),
        ("Align center", "Aligner au centre"),
        ("Align right", "Aligner à droite"),
        ("Sort", "Trier"),
        ("Filter", "Filtrer"),
        ("Export", "Exporter"),
        ("Delete selected rows", "Supprimer les lignes sélectionnées"),
        ("Sort Ascending", "Tri ascendant"),
        ("Sort Descending", "Tri descendant"),
        ("Clear filters", "Effacer les filtres"),
        ("Filter by cell's value", "Filtrer par valeur de cellules"),
        ("Hide select rows", "Cacher les lignes sélectionnées"),
        ("Show only select rows", "N’afficher que les lignes sélectionnées"),
        ("Export all records", "Exporter tous les enregistrements"),
        ("Export current page", "Exporter la page active"),
        ("Export current selection", "Exporter la sélection"),
        ("Export records in filter", "Exporter les enregistrements filtrés"),
        ("Move up", "Déplacer vers le haut"),
        ("Move down", "Déplacer vers le bas"),
        ("Move to top", "Déplacer en premier"),
        ("Move to bottom", "Déplacer en dernier"),
        ("Mo", "Lu"),
        ("Tu", "Ma"),
        ("We", "Me"),
        ("Th", "Je"),
        ("Fr", "Ve"),
        ("Sa", "Sa"),
        ("Su", "Di"),
    )
)

MESSAGES.append(
    # German translation
    LocaleMsgs(
        "de-de",
        ("OK", "OK"),
        ("Ok", "Ok"),
        ("Continue", "Weiter"),
        ("Retry", "Wiederholen"),
        ("Delete", "Löschen"),
        ("Next", "Nächster"),
        ("Prev", "Vorheriger"),
        ("Yes", "Ja"),
        ("No", "Nein"),
        ("Open", "Öffnen"),
        ("Close", "Schließen"),
        ("Add", "Hinzufügen"),
        ("Remove", "Löschen"),
        ("Submit", "Verwenden"),
        ("Family", "Familie"),
        ("Weight", "Bedeutung"),
        ("Slant", "Neigung"),
        ("Effects", "Effekte"),
        ("Preview", "Vorschau"),
        ("Size", "Größe"),
        ("Should be a of data type", "Sollte vom Datentyp sein"),
        ("Invalid data type", "Falscher Datentyp"),
        ("Number cannot be greater than", "Zahl kann nicht größer sein als"),
        ("Out of range", "Ausserhalb des Bereiches"),
        ("Previous", "Vorheriger"),
        ("The quick brown fox jumps over the lazy dog.", "The quick brown fox jumps over the lazy dog."),
        ("Font Selector", "Schriftfont Auswahl"),
        ("normal", "normal"),
        ("bold", "fett"),
        ("negrito", "schwarz"),
        ("roman", "Antiqua"),
        ("italic", "kursiv"),
        ("underline", "unterstrichen"),
        ("overstrike", "durchgestrichen"),
        ("Color Chooser", "Farbauswahl"),
        ("Advanced", "Erweitert"),
        ("Themed", "Themed"),
        ("Standard", "Standard"),
        ("Current", "Aktuell"),
        ("New", "Neu"),
        ("Hue", "Farbton"),
        ("Sat", "Sat"),
        ("Lum", "Lum"),
        ("Hex", "Hex"),
        ("Red", "Rot"),
        ("Green", "Grün"),
        ("Blue", "Blau"),
        ("color dropper", "Farbauswahl"),
        ("Cancel", "Abbrechen"),
        ("Search", "Suchen"),
        ("Page", "Seite"),
        ("of", "von"),
        ("⎌", "↺"),
        ("Reset table", "Tabelle zurücksetzen"),
        ("Columns", "Spalten"),
        ("Move", "Verschieben"),
        ("Align", "Ausrichten"),
        ("Hide column", "Spalte verbergen"),
        ("Delete column", "Spalte löschen"),
        ("Show All", "Alles anzeigen"),
        ("Move to left", "Verschiebe nach links"),
        ("Move to right", "Verschiebe nach rechts"),
        ("Move to first", "Verschiebe an den Anfang"),
        ("Move to last", "Verschiebe an das Ende"),
        ("Align left", "Links ausrichten"),
        ("Align center", "Zentrieren"),
        ("Align right", "Rechts ausrichten"),
        ("Sort", "Sortieren"),
        ("Filter", "Filtern"),
        ("Export", "Exportieren"),
        ("Delete selected rows", "Lösche ausgewählte Zeilen"),
        ("Sort Ascending", "Sortiere aufsteigend"),
        ("Sort Descending", "Sortiere absteigend"),
        ("Clear filters", "Filter löschen"),
        ("Filter by cell's value", "Filtern nach Zellinhalt"),
        ("Hide select rows", "Zeilen verbergen"),
        ("Show only select rows", "Nur ausgewählte Zeilen anzeigen"),
        ("Export all records", "Alle Daten exportieren"),
        ("Export current page", "Aktuelle Seite exportieren"),
        ("Export current selection", "Aktuelle Auswahl exportieren"),
        ("Export records in filter", "Alle gefilterten Daten exportieren"),
        ("Move up", "Nach oben verschieben"),
        ("Move down", "Nach unten verschieben"),
        ("Move to top", "An den Anfang verschieben"),
        ("Move to bottom", "An das Ende verschieben"),
        ("Mo", "Mo"),
        ("Tu", "Di"),
        ("We", "Mi"),
        ("Th", "Do"),
        ("Fr", "Fr"),
        ("Sa", "Sa"),
        ("Su", "So"),
    )
)
